<!DOCTYPE html>

<html>

	<head>
		<meta charset="utf-8">
		<title>我的课程</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<link rel="stylesheet" href="../../statics/layui/css/layui.css" media="all">
		<link rel="stylesheet" href="../../css/student-admin.css" media="all">
		<link rel="stylesheet" href="../../css/student-template.css" media="all">
		<style>
			.myStyle {
				border:1px solid red;
			};
			
			
		</style>
	</head>

	<body>
		<div class="layui-fluid layadmin-maillist-fluid">
			<div class="layui-row layui-col-space15" id="mydeatil">

				<!--<div class="layui-col-md6 layui-col-sm6">
					<div class="cmdlist-container">
						<a href="javascript:;">
						</a>
						<a href="javascript:;">
							<div class="cmdlist-text">
								<p class="info">2018春夏季新款港味短款白色T恤+网纱中长款chic半身裙套装两件套</p>
								<div class="price">
									<b>￥79</b>
									<p>
										¥
										<del>130</del>
									</p>
									<span class="flow">
                      <i class="layui-icon layui-icon-rate"></i>
                      433
                    </span>
								</div>
							</div>
						</a>
					</div>
				</div>-->

			</div>
		</div>

		<script src="../../statics/layui/layui.js"></script>
		<script src="../../statics/jquery/jquery-3.2.1.min.js"></script>
		<script src="../../statics/lay/system/admin/public.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			mydeatil();
			//请求数据
			function mydeatil() {
				$.ajax({
					type: "get",
					url: IP + "/api/teacher_eav/teacherLogin/withMeCourses",
					async: false,
					success: function(data) {
						renderingAll(data);
					}
				});
			}
			//渲染页面
			function renderingAll(data) {
				var html = "暂无课程";
				var classtype = '';
				$.each(data.data, function(i, object) {
					//1:本科，2:专科，3:高职，4:成教
					if(object.classType == 1) {
						classtype = '本科';
					}
					if(object.classType == 2) {
						classtype = '专科';
					}
					if(object.classType == 3) {
						classtype = '高职';
					}
					if(object.classType == 4) {
						classtype = '成教';
					}
					html = '<div class="layui-col-md6 layui-col-sm6">' +
						'<div class="cmdlist-container">' +
						'<a href="javascript:;" class="myStudents" title="点击查看" classno=' + object.classId + '>' +
						'<div class="cmdlist-text">' +
						'<p class="info" style="font-size:16px">课程编号：' + object.cId + '</p>' +
						'<p class="info" style="font-size:16px">课程：' + object.cName + '</p>' +
						'<p class="info">班级编号：' + object.classNum + ' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;班级名称：' + object.className + '</p>' +
						'<p class="info">类型：' + classtype + '</p>' +
						'<div class="price">' +
						'<b><i class="layui-icon layui-icon-user"></i> 学生：' + object.sumStudnet + '人</b>' +
						'<span class="flow">创建时间：' +
						object.createTime.replace(/\s[\x00-\xff]*/g, '') +
						'</span>' +
						'</div>' +
						'</div>' +
						'</a>' +
						'</div>' +
						'</div>';
					$('#mydeatil').append(html);
				})
			}
			$('#mydeatil').on('click', '.myStudents', function() {
				console.log($(this).attr('classno'));
				var classId = $(this).attr('classno');
				window.location.href = 'myStudents.html?classId=' + classId + ''
			})
		</script>
	</body>

</html>